#include "env.h" env_h env_create( env ) env_h env ; void env_destroy( env ) env_h env ; env_h env_make( env_strings ) char **env_strings ; int env_addvar( env, from_env, var ) env_h env ; env_h from_env ; char *var ; int env_addstr( env, str ) env_h env ; char *str ; int env_remvar( env, var ) env_h env ; char *var ; char **env_getvars( env ) env_h env ;
env_create() creates a new environment. The new environment will be empty unless the argument env is not ENV_NULL. In that case, the new environment will be a duplicate of env (i.e. they will contain the same strings).
env_destroy() destroys the specified environment.
env_make() creates a new environment which includes the env_strings. env_strings should be a NULL-terminated array of strings.
env_addvar() adds the specified variable var to env. The variable value is obtained from the environment from_env. If the variable exists already in env the old value is replaced with the new value.
env_addstr() adds a string of the form name=value to env.
env_remvar() removes the specified variable var from the environment env.
env_lookup() searches env for variable var. It returns a string of the form name=value where name is the name of the variable (i.e. it is equal to var).
env_getvars returns a NULL-terminated array of strings of the form name=value.
env_create() returns a handle or ENV_NULL if it fails.
env_make() returns a handle or ENV_NULL if it fails.
env_addvar() returns ENV_OK on success or ENV_ERR on failure.
env_addstr() returns ENV_OK on success or ENV_ERR on failure.
env_remvar() returns ENV_OK on success or ENV_ERR if the variable is not part of the environment.
env_loopkup() returns a string on success or NULL on failure.